﻿Imports BUS
Imports DTO
Imports System.Net.Mime.MediaTypeNames
Imports Microsoft.Office.Interop
Imports System.Data.SqlClient

Public Class frmHOADON
    Dim hoadon As New HoaDonDTO()
    Dim hdbus As New HoaDonBUS()


    Private Sub btt_Thoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub

    Private Sub Clear()
        txt_dongia.Text = ""
        txt_soluong.Text = ""
        txt_tongTien.Text = ""
    End Sub

    Private Sub btn_Them_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Them.Click
        Dim hd As New HoaDonDTO
        hd.MaSP = HoaDonBUS.laytheoid(cbb_tenMh.SelectedValue())
        hd.NgayMua = dtp_Ngaymua.Value()
        hd.SoLuong = txt_soluong.Text()
        hd.MaNV = NhanVienBUS.LAYTHEIID(cbb_tennv.SelectedValue())
        hd.TongTien = txt_tongTien.Text()
        hd.DonGia = txt_dongia.Text()
        HoaDonBUS.ThemHD(hd)
    End Sub

    Private Sub loadCbb()

        'cbb_tenMh.DataSource = HoaDonBUS.laytheoid()
        cbb_tenMh.DisplayMember = "TenSP"
        cbb_tenMh.ValueMember = "MaSP"
    End Sub


    Private Sub frmHOADON_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DBNGKDataSet4.HOADON' table. You can move, or remove it, as needed.
        loadHD()
        loadCbb()
    End Sub

    Private Sub loadHD()
        DataGridView1.DataSource = HoaDonBUS.loadDS()
    End Sub

    Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

    End Sub

    Private Sub ComboBoxEx1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbb_tenMh.SelectedIndexChanged

    End Sub

    Private Sub btn_Nhaplai_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Nhaplai.Click

    End Sub
End Class